﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!doctype html>
<!DOCTYPE html>
<html>
<head>
	<title><spring:message code="YYK-title-100014" /></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=0.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
	<meta name=”apple-mobile-web-app-capable” content=”yes” />
	<link rel="stylesheet" type="text/css" href="${static_server}/static/css/default.css">
	<link rel="stylesheet" href="${server}/static/css/iconfont/iconfont.css">
	<script type="text/javascript" src="${static_server}/static/js/resize.js"></script>
	<script type="text/javascript" src="${static_server}/static/js/common/base.js"></script>
	<script type="text/javascript" src="${static_server}/static/js/common.js"></script>
	<script type="text/javascript" src="${static_server}/static/js/zepto.min.js"></script>
	<link rel="stylesheet" href="${static_server}/static/css/common/zepto.alert.css">
	<script type="text/javascript" src="${static_server}/static/js/common/zepto.alert.js"></script>
	
	<style>
.editPerInfoComponent .basicInfo li label{width: 1.1rem;}
.getCodeLi{position: relative;}
.getTelCode{position: absolute;display: inline-block;width: 1.9rem;height: 0.6rem;line-height: 0.6rem;border-radius: 3px;border: 1px solid #1db820;text-align: center;top: 0.1rem;}
.getting{background: #eee;color: #aaa;border: 1px solid #ddd}
	</style>
</head>
<body>
<div class="wrap">
	<!-- <header class="headerToFixed">
		<div class="closeBtn" onclick="javascript:goBack();">
			   <i class="icon iconfont">&#xe60a;</i>
		</div>
		<div class="headerTitle">
			个人信息
		</div>
	</header> -->
	<header class="headerToFixed">
		<div class="closeBtn" onclick="javascript:goBack();">
			   <i class="icon iconfont">&#xe60a;</i>
		</div>
	</header>
	<div class="contentWrap">
		<div class="editPerInfoComponent mts15">
			<ul class="basicInfo">
			 	<li>
			 		<label for="personalTel">手机号</label>
			 		<input id="personalTel" type="text" value="${user.userTel}" placeholder="请输入手机号码"/>
			 	</li>
			 <!-- 	<li class="getCodeLi">
			 		<label for="personalCode">验证码</label>
			 		<input id="personalCode" type="text" placeholder="请输入验证码"/>
			 		<div id="getTelCode" class="fr getTelCode">
			 			获取验证码
			 		</div>
			 		<div id="getTelCode" class="fr getTelCode getting">
			 			正在获取验证码
			 		</div>
			 	</li> -->
			 </ul>
		</div>
	</div>
	<footer class="footerToFixed">
		<div class="operateBtnG" id="submitBtn">
			保存
		</div>
	</footer>
</div>
<input type="hidden" id="path" value="${server}"/>
</body>

<script type="text/javascript">
$(document).ready(function (){
	$("#submitBtn").on('click',function (){
		var path = $("#path").val();
		var telnum = $('#personalTel').val();//.replaceAll("\\s","");
		$('#personalTel').val(telnum);
		var reg = new RegExp("^[0-9]{11}$");
		if(!reg.test(telnum)){
			$.dialog({
 			    content : "手机号应为11为数字",
 			    title: "",
 			    time : 2000
 			});
			return ;
		}else{
			$.ajax({
		        type: "post",
		        dataType: "text",
		       // async:true,
		        url:path+"/user/addUserTel/"+telnum,
		        success: function (result) {
		        	if(result=="success"){
		        		$.dialog({
		     			    content : "手机号添加成功",
		     			    title: "",
		     			    time : 2000
		     			});
		        		setTimeout(function(){window.location.href=path+"/user/index"},2000);
		        	}else{
		        		$.dialog({
		     			    content : "手机号添加失败",
		     			    title: "",
		     			    time : 2000
		     			});
		        	}
		        }
			});
		}
	})
	
	
	
})
</script>
</html>	